<?php
    require_once "UsersManager.php";
    require_once "NotificationsManager.php";

    
    // Type of operation: Add, Update, Delete
    $operation = $argv[3];
    
    // Course Code
    $courseCode = $argv[1];
    
    // Start Date
    $startDate = $argv[2];
    
    // Language
    $language = $argv[4];
    setLocalizedStrings($language);
    
    // Notifications Manager
    $notificationsManager = new NotificationsManager();	
    
    // Check Operation
    if ($operation == 'a') {
        // Add Operation
        $notificationsManager->createMessageAndNotifyDevices(Strings::BOOKING_ADDED, $courseCode, $startDate);
    } else if ($operation == 'd') {
        // Delete operation
        $notificationsManager->createMessageAndNotifyDevices(Strings::BOOKING_DELETED, $courseCode, $startDate);
    } else if ($operation == 'u') {
        // Update operation
        $notificationsManager->createMessageAndNotifyDevices(Strings::BOOKING_UPDATED, $courseCode, $startDate);
    }
    
    // Set Language
    function setLocalizedStrings($language) {
        if ($language == "ro") {
            require_once "utils/Localized_RO.php";
        } else {
            require_once "utils/Localized_EN.php";
        }
	}
?>